import { computed, getCurrentInstance } from "vue";
import useEmployeeHook from "./employeeHook/useEmployeeHook";
import menuHook from "./menuHook/menuHook";
import { itforceUploadDatas } from './dyformHook/dyformHook'
import { Local } from "@/utils/storage";
import { userHook } from "./userHook/userHook";
import treeHook from './TreeHook/treeHook'
import locale from "@/utils/i18n";
import { getToken } from "@/utils/auth";
const { value } = locale.global.locale;

export class hooksIndex {
  proxy: any | null;
  constructor(proxy: any | null) {
    this.proxy = proxy;
  }
  isArabic = computed(() => {
    const locale = this.proxy.$i18n.locale;
    // // consolelog('locale:', locale);
    if (locale === "arabic") {
      return true;
    }
    return false;
  });
  isCn = computed(() => {
    const locale = this.proxy.$i18n.locale;
    if (locale === "zh-CN") return true;
    return false;
  });
  isEn = computed(() => {
    const locale = this.proxy.$i18n.locale;
    if (locale === "en-US") return true;
    return false;
  });
}
export const useLanguage = () => {

  const isArabic = computed(() => {
    const { value } = locale.global.locale;
    // const { proxy } = getCurrentInstance() as any;
    // const locales = proxy ? value : proxy.$i18n.locale;
    const locales = value;
    if (locales === "arabic") {
      // consolelog('arabic进来了');
      return true;
    }
    return false;
  });
  const isCn = computed(() => {
    const { value } = locale.global.locale;
    // const { proxy } = getCurrentInstance() as any;
    // const locales = proxy ? value : proxy.$i18n.locale;
    const locales = value;
    if (locales === "zh-CN") return true;
    return false;
  });
  const isEn = computed(() => {
    const { value } = locale.global.locale;
    // const { proxy } = getCurrentInstance() as any;
    // const locales = proxy ? value : proxy.$i18n.locale;
    const locales = value;
    if (locales === "en-US") return true;
    return false;
  });
  return {
    isArabic,
    isCn,
    isEn,
  };
};
export const isArS = computed(() => {
  const locales = Local.get("localLanguage") || value;
  if (locales === "arabic") {
    return true;
  }
  return false;
});
export const isCnS = computed(() => {
  const locales = Local.get("localLanguage") || value;
  if (locales === "zh-CN") return true;
  return false;
});
export const isEnS = computed(() => {
  const locales = Local.get("localLanguage") || value;
  if (locales === "en-US") return true;
  return false;
});
export const employeeStore: any = useEmployeeHook
export default {
  employeeStore,
  userHook,
  menuHook,
  itforceUploadDatas,
  treeHook,
  useLanguage,
  isArS,
  isCnS,
  isEnS
};